aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/[username]/receive
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-09-13 23:18:40 -0700
committerAdam Soltys <[email protected]>2022-09-13 23:18:40 -0700
commitdfe32780e0862515eb4b2ddebae9fcfb2198704a (patch)
treef8b463ccc51291393c71cc3c95ca3725c74d341b /src/routes/[username]/receive
parentcfdc6ed4a98e1eb60aba653d4403138a8fcaa4c2 (diff)
downloadcoinos-ui-dfe32780e0862515eb4b2ddebae9fcfb2198704a.tar.gz
coinos-ui-dfe32780e0862515eb4b2ddebae9fcfb2198704a.zip
currency formatting helpers
Diffstat (limited to 'src/routes/[username]/receive')
-rw-r--r--src/routes/[username]/receive/+page.svelte15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/routes/[username]/receive/+page.svelte b/src/routes/[username]/receive/+page.svelte
index f83fc953..12960984 100644
--- a/src/routes/[username]/receive/+page.svelte
+++ b/src/routes/[username]/receive/+page.svelte
@@ -3,7 +3,7 @@
import { AppHeader, Icon } from '$comp';
import { goto } from '$app/navigation';
import { invoiceAmount, invoiceAmountFiat, selectedRate, user } from '$lib/store';
- import { post, warning } from '$lib/utils';
+ import { f, s, post, warning } from '$lib/utils';
import { page } from '$app/stores';
import { t } from '$lib/translations';
@@ -19,18 +19,11 @@
amountFiat === 0 ? amountSats * ($selectedRate / 100000000) : amountFiat
);
- $: amountSatsFormatted = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(
- amountSats
- );
+ $: amountSatsFormatted = s(amountSats);
- $: amountFiatConverted = new Intl.NumberFormat('en-US', {
- style: 'currency',
- currency: $user.currency
- }).format(amountSats * ($selectedRate / 100000000));
+ $: amountFiatConverted = f(amountSats * ($selectedRate / 100000000), $user.currency);
- $: amountSatsConverted = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(
- amountFiat / ($selectedRate / 100000000)
- );
+ $: amountSatsConverted = s(amountFiat / ($selectedRate / 100000000));
const numPad = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '0', '<'];